min = 0
input_num = -1

while input_num != 23:
    try:
        input_num = int(input('please enter a number from 1 to 50 (23 to stop) : '))
    except Exception as e:
        print('\n', 'invalid input number')
        continue
    if input_num == 23:
        break
    if min == 0 or min >= input_num:
        min = input_num

print('the Minimum value is', min)
